package com.soecode.wxtools.bean;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class WxMenu {

    private List<WxMenuButton> button = new ArrayList<WxMenuButton>();

    private WxMenuRule matchrule;

    private String menuid;

    public String toJson() {
        return JSONObject.toJSONString(this);
    }

    public static WxMenu fromJson(String json) {
        return JSONObject.parseObject(json, WxMenu.class);
    }

    @Data
    public static class WxMenuButton {

        private String type;
        private String name;
        private String key;
        private String url;
        private String appid;
        private String pagepath;

        private List<WxMenuButton> sub_button = new ArrayList<WxMenuButton>();
    }

    @Data
    public static class WxMenuRule {

        private String tag_id;
        private String sex;
        private String country;
        private String province;
        private String city;
        private String client_platform_type;
        private String language;
    }

}
